package org.example.microservice.sys.feign;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/feign/system")
public class SystemFeignImpl {

    @GetMapping("/info")
    public Map<String, Object> systeminfo() {
        Map<String, Object> map = new HashMap<>();
        try {
            InetAddress address = InetAddress.getLocalHost();
            map.put("hostname", address.getHostName());
            map.put("hostAddress", address.getHostAddress());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return map;
    }
}
